var zss_editor = {};
zss_editor.isUsingiOS = false;

$(".yinji_edit_text").on("click","img", function() {
	if($(this).hasClass("yinji_templates_voice_play_audio")){
		$(this).addClass('cur');
		zss_editor.stopvideo();
	}
               
});

zss_editor.setFontFaMily = function(font) {
    $('body').css("font-family",font);
}

zss_editor.play_init = function() {
    $(".yinji_templates_voice_play_audio").removeClass('yinji_templates_voice_play');
    $(".yinji_templates_voice_play_audio").removeClass('yinji_templates_voice_playenter');
    $(".yinji_templates_voice_play_audio").removeClass('yinji_templates_voice_playing');
    $(".yinji_templates_voice_play_audio").removeClass('cur');
    $(".yinji_templates_voice_play_audio").addClass('yinji_templates_voice_play');
}

zss_editor.stopvideo = function(){
    if ($(".yinji_templates_voice_play_audio").hasClass('cur')) {
        $(".cur").addClass('yinji_templates_voice_playend');
        $(".cur").removeClass('yinji_templates_voice_playenter');
        $(".cur").removeClass('yinji_templates_voice_playing');
		setTimeout(function(){
			$(".cur").removeClass('yinji_templates_voice_playend');
			$(".cur").removeClass('cur');
			zss_editor.play_init();
		},400);
    }
}

zss_editor.play_init();


var current_audio_id = "";
var audio_prefix = "audio_";
var obj_audio;
function playOrPaused(id){
	obj_audio = document.getElementById(audio_prefix + id);
	if(current_audio_id == id){
			/*处理暂停、播放 图片切换*/
			if(obj_audio.paused){
					obj_audio.play();
					return ;
			}else{
					obj_audio.pause();
					return ;
			}
	}
	/*处理播放完成后回调，是否继续播放下一个音频*/
	obj_audio.play();
}

$("audio").on("ended", function(event){
	console.log("over");
    current_audio_id = "";
});

HTMLAudioElement.prototype.stop = function() {
	console.log("over");
	this.pause();
	this.currentTime = 0.0;
};